/*
 * @Author: weidewei
 * @Date: 2025-10-21 09:51:33
 * @LastEditors: weidewei
 * @LastEditTime: 2025-11-19 15:37:05
 * @Description: 
 * @FilePath: \2025-front-face\vite-react-ts-template\src\pages\user.tsx
 */
import { useLoaderData, Await, useAsyncValue } from 'react-router-dom';

import type { User } from '@/router/loader';

export default function User() {
  const { data } = useLoaderData() as { data: Promise<User[]> };
  return (
    <Await resolve={data}>
      <List />
    </Await>
  );
}

const List = () => {
  const data = useAsyncValue() as User[];
  return (
    <>
      {data.map((o) => (
        <div key={o.id}>{o.name}</div>
      ))}
    </>
  );
};
